<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>在data属性中设置对应的数字</title>
    <script src="vue.js"></script>
  </head>
  <body>
    <div id="app">
      <parent></parent>
    </div>
    <script>
      var childNode = {
        template: `
        <div><p>{{ appPara1 }}的数据类型是{{ type1 }}</p>
             <p>{{ appPara2 }}的数据类型是{{ type2 }}</p>
         </div>
        `,
        props: ["appPara1", "appPara2"],
        computed: {
          type1() {
            return typeof this.appPara1;
          },
          type2() {
            return typeof this.appPara2;
          },
        },
      };
      var parentNode = {
        template: `
    <div>
       <child :app-para1="data1"></child>
       <child :app-para2="data2"></child>
    </div>`,
        components: {
          child: childNode,
        },
        data() {
          return {
            data1: 123,
            data2: "456",
          };
        },
      };
      // 创建根实例
      new Vue({
        el: "#app",
        components: {
          parent: parentNode,
        },
      });
    </script>
  </body>
</html>
